from django.db.models import CharField,IntegerField,ForeignKey,DO_NOTHING,TextField,DateField,DateTimeField,BooleanField
from apps.vadmin.op_drf.models import CoreModel


class CheckRecords(CoreModel):
    asset_id = IntegerField(null=True,verbose_name="资产id")
    asset_name = CharField(max_length=256,null=True,verbose_name="资产名称")
    asset_type = CharField(max_length=32,null=True,verbose_name="资产类型")
    check_datetime = DateTimeField(null=True,verbose_name="用户填写的登记时间，如果没写取创建时间")
    expected_checkin_date = DateField(null=True,verbose_name="预计归还时间")
    assigned_type = CharField(max_length=32,null=True,verbose_name="借出类型") # asset/user/location,可以借给人，可以借给资产，可以借给位置
    assigned_to_id = IntegerField(null=True,verbose_name="借出到目标的id")
    assigned_to_name = CharField(max_length=256,null=True,verbose_name="借出到目标名称")
    option = CharField(max_length=32,null=True,verbose_name="操作类型，借出/归还")
    qty = IntegerField(null=True,verbose_name="数量")
    notes = CharField(max_length=256,null=True,verbose_name="归还备注")


    class Meta:
        verbose_name = '借用归还记录表'
        verbose_name_plural = verbose_name
        ordering = ['-id']  # 按id降序
